using MicroMsg.Common.Utils;
using MicroMsg.Manager;
using MicroMsg.Protocol;
using MicroMsg.Resource.@string;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using Microsoft.Phone.Controls;
using System;
using System.Windows;
using System.Windows.Media.Imaging;
namespace MicroMsg.Plugin.FaceBook
{
	public class FaceBook : PluginBase
	{
		private const string TAG = "FaceBook";
		public const string PluginKey = "Plugin FaceBook";
		public const long PluginID = 32776L;
		public const string PluginName = "FaceBook";
		public const int PluginVersion = 256;
		private static FaceBook mInstance;
		public override string mTitle
		{
			get
			{
				return "facebook";
			}
		}
		public override string mFFEntryTitle
		{
			get
			{
				return strings.FaceBookTabTitle;
			}
		}
		public override BitmapSource mIcon
		{
			get
			{
				if (MMTheme.IsCoolBlackTheme())
				{
					return ImageCacheMgr.loadFromRes("Source/Plugin/Facebook/Resource/Img/plugin_setting_cool.png");
				}
				return ImageCacheMgr.loadFromRes("Source/Plugin/Facebook/Resource/Img/plugin_setting_normal.png");
			}
		}
		public override BitmapSource mIconHD
		{
			get
			{
				return null;
			}
		}
		public override BitmapSource mIconInList
		{
			get
			{
				return ImageCacheMgr.loadFromRes("Resource/Img/Plugin/FaceBook/facebook.png");
			}
		}
		public override string mDescription
		{
			get
			{
				return strings.FaceBookCanAdd;
			}
		}
		public override string mAuthor
		{
			get
			{
				return "tencent";
			}
		}
		public FaceBook()
		{
			this.mKey = "Plugin FaceBook";
			this.mID = 32776L;
			this.mName = "FaceBook";
			this.mVersion = 256;
			this.mIndexInTab = MainTabIndex.AddFriendList;
			this.mIndexInGroup = 0;
			this.mIndexInPosition = 3;
			this.mDefaultInstalled = true;
			if (FaceBookMgr.IsChina())
			{
				this.mEnabled = false;
			}
			else
			{
				this.mEnabled = true;
			}
			FaceBook.mInstance = this;
			if (MMTheme.IsCoolBlackTheme())
			{
				base.mIconInFFEntry = ImageCacheMgr.loadFromRes("Resource/Img/Plugin/FaceBook/facebook.png");
				return;
			}
			base.mIconInFFEntry = ImageCacheMgr.loadFromRes("Resource/Img/Plugin/FaceBook/facebook_light.png");
		}
		public override PluginSettingBaseCtrl GetPluginSettingCtrl()
		{
			return new FaceBookPluginSetCtrl();
		}
		private void onBtnClickLbs(object sender, RoutedEventArgs e)
		{
			this.execute(4, null);
		}
		public static FaceBook getInstance()
		{
			return FaceBook.mInstance;
		}
		public override void onRegisterResult(RetConst retConst_0, int code)
		{
			Log.smethod_4("FaceBook", string.Concat(new object[]
			{
				"on register result , ret = ",
				retConst_0,
				", code = ",
				code
			}));
		}
		public override bool onInitialize()
		{
			Log.smethod_4("FaceBook", "initialize. ");
			FBServiceCenter.init();
			return true;
		}
		public override bool onInstalled(InstallMode mode)
		{
			Log.smethod_4("FaceBook", "on inistalled. ");
			return true;
		}
		public override bool onUninstalled(InstallMode mode)
		{
			Log.smethod_4("FaceBook", "on uninstalled. ");
			return true;
		}
		public override bool onParseChatMsg(ChatMsg chatMsg)
		{
			return false;
		}
		public override object execute(int entryType, object args)
		{
			Log.smethod_4("FaceBook", "plugin execute,   entrytype =" + entryType);
			if (entryType == 1)
			{
				return null;
			}
			if (entryType == 2)
			{
				return null;
			}
			if (entryType == 3)
			{
				this.entryFromFriendTab();
				return null;
			}
			if (entryType == 4)
			{
				this.entryFromSettingTab();
				return null;
			}
			return null;
		}
		private void entryFromFriendTab()
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			BasePage basePage = phoneApplicationFrame.get_Content() as BasePage;
			if (basePage == null)
			{
				return;
			}
			Account curAccount = AccountMgr.getCurAccount();
			if (curAccount == null)
			{
				return;
			}
			if (curAccount.FaceBookFlag <= 0u)
			{
				FaceBookBind.ShowBindPage(basePage, false);
				return;
			}
			FaceBookFriends.ShowFaceBookFriendsPage(basePage, curAccount.FBToken, false);
		}
		private void entryFromSettingTab()
		{
		}
	}
}
